﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Vuforia;

public class VBController : MonoBehaviour,IVirtualButtonEventHandler
{
    public GameObject Cube;
    public GameObject Sphere;
    public GameObject text;
    GameObject vb1;
    GameObject vb2;

    void Start()
    {
        vb1 = GameObject.Find("SwitchButton");
        vb1.GetComponent<VirtualButtonBehaviour>().RegisterEventHandler(this);
        vb2 = GameObject.Find("ShowTextButton");
        vb2.GetComponent<VirtualButtonBehaviour>().RegisterEventHandler(this);
    }

    public void OnButtonPressed(VirtualButtonBehaviour vb)
    {
        switch (vb.VirtualButtonName)
        {
            case "Show1":
                Cube.SetActive(false);
                Sphere.SetActive(true);
                break;
            case "Show2":
                text.SetActive(true);
                break;
        }
        Debug.Log("OnButtonPressed" + vb.VirtualButtonName);    
    }

    public void OnButtonReleased(VirtualButtonBehaviour vb)
    {
        switch (vb.VirtualButtonName)
        {
            case "Show1":
                Cube.SetActive(true);
                Sphere.SetActive(false);
                break;
            case "Show2":
                text.SetActive(false);
                break;
        }
        Debug.Log("OnButtonReleased" + vb.VirtualButtonName);
    }

    void Update()
    {
        
    }
}
